package com.example.lp.lpuicore.views.ui;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.example.lp.lpuicore.R;
import com.example.lp.lpuicore.views.ui.Fragnemt.BaseFragment;
import com.example.lp.lpuicore.views.ui.Fragnemt.FragmentAdapter;
import com.example.lp.lpuicore.views.ui.Fragnemt.PaintViewFragement;
import com.example.lp.lpuicore.views.ui.Fragnemt.UiAboutFragement;

import java.util.ArrayList;


public class UiActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ui);
        initview();
    }

    private void initview() {
        ArrayList<BaseFragment> fragments = new ArrayList<>();
        fragments.add(new PaintViewFragement());
        fragments.add(new UiAboutFragement());
        TabLayout tabLayout = findViewById(R.id.tab);
        ViewPager viewPager = findViewById(R.id.view_pager);
        FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragments);
        viewPager.setAdapter(fragmentAdapter);
        tabLayout.setupWithViewPager(viewPager, false);
    }
}
